﻿@model Products.Databases.Field
@{
    var currentTable = (Products.Databases.Table)ViewData["Table"];
    ViewBag.Title = "Create field for " + currentTable.Name;
    Layout = "~/Views/Shared/App.cshtml";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm())
{
    <input name="tableId" type="hidden" value="@currentTable.Id"/>
    @Html.ValidationSummary(true)
    <div class="cssform">
        <p>
            @Html.LabelFor(model => model.SqlType)
            @Html.EditorFor(model => model.SqlType)
            @Html.ValidationMessageFor(model => model.SqlType)
        </p>
        <p>
            @Html.LabelFor(model => model.Length)
            @Html.EditorFor(model => model.Length)
            @Html.ValidationMessageFor(model => model.Length)
        </p>
        <p>
            @Html.LabelFor(model => model.Name)
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </p>
        <p>
            @Html.LabelFor(model => model.Memo)
            @Html.TextAreaFor(model => model.Memo)
            @Html.ValidationMessageFor(model => model.Memo)
        </p>
        <p>
            <label>
                Versions:</label>
            <select name="versionId" id="versions">
                @foreach (Products.ProductVersion v in currentTable.Product.Versions)
                {
                    <option value="@v.Id">@v.Name</option>
                }
            </select>
        </p>
        <p>
            <input type="submit" value="Create" />
        </p>
    </div>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
@section PageTitle{
    Create field for @currentTable.Name
}
